﻿namespace MvcFckEditor.Models
{
    using System;
    using System.Runtime.CompilerServices;

    public class FckItemInfo
    {
        public int Height { get; set; }

        public string Icon { get; set; }

        public string Name { get; set; }

        public int ThumbHeight
        {
            get
            {
                if (this.Height > this.Width)
                {
                    if (this.Height > 100)
                    {
                        return 100;
                    }
                    return this.Height;
                }
                if (this.Width > 100)
                {
                    return Convert.ToInt32((double) (this.Height * (100.0 / ((double) this.Width))));
                }
                return this.Height;
            }
        }

        public int ThumbWidth
        {
            get
            {
                if (this.Width >= this.Height)
                {
                    if (this.Width > 100)
                    {
                        return 100;
                    }
                    return this.Width;
                }
                if (this.Height > 100)
                {
                    return Convert.ToInt32((int) (this.Width * (100 / this.Height)));
                }
                return this.Width;
            }
        }

        public string Tip { get; set; }

        public string Url { get; set; }

        public int Width { get; set; }
    }
}

